<?php
/**
 * Description:
 *
 * @author      Eden
 * @datetime    2017/2/18 17:19
 * @copyright   WuHan HuQi Technology Co.,Ltd.
 * @url         http://cnhuqi.com
 */


class Cashin extends ADM_Controller
{

    const PAGE_SIZE = 20;

    /**
     * 初始化
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 提现
     */
    public function index()
    {
        $this->load->view('admin/money/cashin_list.html');
    }


    public function getLists()
    {
        $send['state'] = false;
        do {

            $page = $this->input->get('page');
            $page = !empty($page) && $page > 0 ? $page : 1;
            $offset = ($page - 1) * self::PAGE_SIZE;

            $this->load->model('common/Cash_Model', 'cash');
            $res = $this->cash->cashinList($offset, self::PAGE_SIZE);

            $total = $this->cash->getTotal();

            $send['state'] = true;
            $send['data'] = [
                'total' => $total,
                'data' => $res,
                'nextPage' => ($offset + self::PAGE_SIZE) < $total
            ];

        } while(false);
        $this->output->send($send);
    }

}